import Vue from 'vue'
import Router from 'vue-router'
import S404 from "@/pages/S404"
import Home from "@/pages/Home"
import Login from "@/pages/Login/Login"

// import Boundary  from "@/pages/Boundary/Boundary"
import qrcode from "@/pages/list/qrcode"
import tips from "@/pages/list/tips"
import wokers from "@/pages/list/wokers"
import rotation from "@/pages/list/rotation"


Vue.use(Router)

//初始路由
let routes0 = [
  {
    path: '/login',
    component: Login,
    name: '登陆',
    hidden: true
  },
];

// 总平台权限
var adminData = [
  {
    path: '/',
    component: Home,
    name: '界面管理',
    iconCls: 'el-icon-s-tools',
    leaf: false,
    children: [
      {
        path: '/list/rotation',
        component: rotation,
        name: '界面管理'
      },
    ]
  },
  {
    path: '/',
    component: Home,
    name: '用户管理',
    iconCls: 'el-icon-user',
    leaf: false,
    children: [
      {
        path: '/list/wokers',
        component: wokers,
        name: '用户管理'
      },
    ]
  },
  {
    path: '/',
    component: Home,
    name: '二维码',
    iconCls: 'el-icon-picture',
    leaf: true,
    children: [
      {
        path: '/list/qrcode',
        component: qrcode,
        iconCls: 'el-icon-picture-outline',
        name: '二维码'
      },
      {
        path: '/list/tips',
        component: tips,
        iconCls: 'el-icon-message-solid',
        name: '提示'
      },

    ]
  },
];


// 子平台 注释： 由于总平台跟子平台的两个页面数据一致 所以他俩页面公用，再次就不在多搞事情了
var routes2 = [


];

//创建一个路由器
export default new Router({
  routes: routes0
})


function getRoute(type) {
  if (type == -1) {
    // 平台管理权限
    return adminData
  } else if (type == 1) {
    // 子平台权限
    return routes2
  } else {
    // 未登陆
    return routes0
  }

}



export { getRoute };